package DAO;

import java.sql.*;
public class ControllerDAO {

	private Connection connexion=null; 
	private Statement instruction=null; 
	ResultSet resultat=null;

	public ControllerDAO() throws ClassNotFoundException
	{
		try
		{
			Class.forName("com.mysql.jdbc.Driver");
			this.connexion=DriverManager.getConnection("jdbc:mysql://localhost:3306/Forum","root","" );
			this.instruction=connexion.createStatement();
		}
		catch(SQLException ex) 
		{
			ex.printStackTrace();
				try
				{
					if (resultat!=null) resultat.close();
					if (instruction!=null) instruction.close();
					if (connexion!=null) connexion.close();
				}
				catch (SQLException tt) {
					tt.printStackTrace();
				}	
		}
		catch(ClassNotFoundException nfe)
		{
			nfe.printStackTrace();
		}
	}
	
	public Connection getConnexion() {
		return connexion;
	}

	public void setConnexion(Connection connexion) {
		this.connexion = connexion;
	}

	public Statement getInstruction() {
		return instruction;
	}

	public void setInstruction(Statement instruction) {
		this.instruction = instruction;
	}

	public ResultSet getResultat() {
		return resultat;
	}

	public void setResultat(ResultSet resultat) {
		this.resultat = resultat;
	}
}
